<?php
/**
 * class Singleton
 * 单例类
 * 
 */
class Lab7_Singleton
{
	static protected $_instance = null;
	protected $_name;
	protected $_age;
	
	static public function getInstance($name='wahaha', $age=18)
	{
		if(self::$_instance == null){
			self::$_instance = new Lab7_Singleton($name, $age);
		}
		return self::$_instance;
	}
	
	private function __construct($name, $age)
	{
		$this->_name = $name;
		$this->_age = $age;
	}
	
	public function getName()
	{
		return $this->_name;
	}
	
	public function getAge()
	{
		return $this->_age;
	}
	
	public function setName($name)
	{
		$this->_name = $name;
	}
	
	public function setAge($age)
	{
		$this->_age = $age;
	}
	
	public function getInfo()
	{
		return 'name:'.$this->_name.'<br />age:'.$this->_age.'<br />';
	}
	
}